package com.cxw.healthserver.configurer;

import com.cxw.healthserver.resolver.CurrentUserHandlerMethodArgResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer
{
    @Bean
    public CurrentUserHandlerMethodArgResolver currentUserMethodArgumentResolver(){
        return new CurrentUserHandlerMethodArgResolver();
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(currentUserMethodArgumentResolver());
    }
}

